package com.wigball.java.jchef.script;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.wigball.java.jchef.model.common.methods.Method;
import com.wigball.java.jchef.model.ingredients.Ingredient;

public class ChefScript {

	private String title;
	
	private String comments;
	
	private String cookingTime;
	
	private String ovenTemperature;
	
	private Map<String, Ingredient> ingredients;
	
	private List<Method> methods;
	
	public ChefScript() {
		ingredients = new HashMap<String, Ingredient>();
		methods = new ArrayList<Method>();
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}
	
	public String getComments() {
		return comments;
	}

	public void setComments(String comments) {
		this.comments = comments;
	}

	public String getCookingTime() {
		return cookingTime;
	}

	public void setCookingTime(String cookingTime) {
		this.cookingTime = cookingTime;
	}

	public String getOvenTemperature() {
		return ovenTemperature;
	}

	public void setOvenTemperature(String ovenTemperature) {
		this.ovenTemperature = ovenTemperature;
	}	
	
	public void addIngredient(Ingredient i) {
		if (i != null) {
			ingredients.put(i.getName(), i);
		}
	}
	
	public Collection<Ingredient> getAllIngredients() {
		return ingredients.values();
	}
	
	public boolean containsIngredient(Ingredient i) {
		if (i == null) {
			return false;
		}
		
		return ingredients.containsKey(i.getName());
	}
	
	public Ingredient getIngredient(String name) {
		return ingredients.get(name);
	}
	
	public void addMethod(Method m) {
		methods.add(m);
	}
	
	public Collection<Method> getAllMethods() {
		return methods;
	}
}

